libxc: NetBSD: implement xc_evtchn_bind_unbound_port.
authorIan Campbell <ian.campbell@citrix.com>
Thu, 2 Dec 2010 12:33:01 +0000 (12:33 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 2 Dec 2010 12:33:01 +0000 (12:33 +0000)
Doesn't actually appear to be used anywhere but is defined for other
OSes.

The NetBSD evtchn.h contains comments "Return allocated port" for
several ioctls which currently return the allocated port as a member
of the argument structure and not as the ioctl return value (I think
this is a cut and paste error).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

tools/include/xen-sys/NetBSD/evtchn.h
tools/libxc/xc_netbsd.c

index dc30e815dc03859b6bead625fcee8ad7580e71ac..2d8a1f916403ec75d87bb789e3ade0bf4a6f55cd 100644 (file)
@@ -33,7 +33,6 @@
 
 /*
  * Bind a fresh port to VIRQ @virq.
- * Return allocated port.
  */
 #define IOCTL_EVTCHN_BIND_VIRQ                         \
        _IOWR('E', 4, struct ioctl_evtchn_bind_virq)
@@ -44,7 +43,6 @@ struct ioctl_evtchn_bind_virq {
 
 /*
  * Bind a fresh port to remote <@remote_domain, @remote_port>.
- * Return allocated port.
  */
 #define IOCTL_EVTCHN_BIND_INTERDOMAIN                  \
        _IOWR('E', 5, struct ioctl_evtchn_bind_interdomain)
@@ -55,7 +53,6 @@ struct ioctl_evtchn_bind_interdomain {
 
 /*
  * Allocate a fresh port for binding to @remote_domain.
- * Return allocated port.
  */
 #define IOCTL_EVTCHN_BIND_UNBOUND_PORT                 \
        _IOWR('E', 6, struct ioctl_evtchn_bind_unbound_port)
index 5958faaf6b6b9dd6a993f46c7d9fdfe4388770b8..47f84853edc61994218b2f69104d6ca5e85054d4 100644 (file)
@@ -205,6 +205,21 @@ int xc_evtchn_notify(int xce_handle, evtchn_port_t port)
     return ioctl(xce_handle, IOCTL_EVTCHN_NOTIFY, &notify);
 }
 
+evtchn_port_or_error_t
+xc_evtchn_bind_unbound_port(int xce_handle, int domid)
+{
+    struct ioctl_evtchn_bind_unbound_port bind;
+    int ret;
+
+    bind.remote_domain = domid;
+
+    ret = ioctl(xce_handle, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
+    if (ret == 0)
+       return bind.port;
+    else
+       return -1;
+}
+
 evtchn_port_or_error_t
 xc_evtchn_bind_interdomain(int xce_handle, int domid,
                            evtchn_port_t remote_port)